package com.alibaba.nacos.naming.core.v2.event.client;

import com.alibaba.nacos.common.notify.Event;
import com.alibaba.nacos.naming.consistency.ephemeral.distro.v2.DistroClientDataProcessor;
import com.alibaba.nacos.naming.core.v2.client.Client;
import lombok.Getter;
import lombok.RequiredArgsConstructor;


/**
 * using by {@link DistroClientDataProcessor}
 */
@RequiredArgsConstructor
public class ClientEvent
        extends Event {
    @Getter
    private final Client client;

    public static class ClientChangeEvent
            extends ClientEvent {

        public ClientChangeEvent(Client client) {
            super(client);
        }
    }

    @Getter
    public static class ClientDisconnectEvent
            extends ClientEvent {
        private boolean isNative;

        public ClientDisconnectEvent(Client client,
                                     boolean isNative) {
            super(client);
            this.isNative = isNative;
        }
    }

    @Getter
    public static class ClientVerifyFailedEvent
            extends ClientEvent {
        private final String clientId;
        private final String targetServe;

        public ClientVerifyFailedEvent(String clientId,
                                       String targetServe) {
            super(null);
            this.clientId = clientId;
            this.targetServe = targetServe;
        }
    }
}

